package com.example.zhidao.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.zhidao.model.po.User;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.base.mapper.MPJJoinMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

//BaseMapper<User>
public interface UserMapper extends MPJBaseMapper<User> {

    //   收藏加一 减一
    @Update("UPDATE user SET collection = collection + 1 WHERE id = #{id}")
    public int addcoll(String id);
    @Update("UPDATE user SET collection = collection - 1 WHERE id = #{id}")
    public int delcoll(String id);

//   粉丝加一
    @Update("UPDATE user SET fan = fan + 1 WHERE id = #{id}")
    public int addfan(String id);
    @Update("UPDATE user SET fan = fan - 1 WHERE id = #{id}")
    public int delfan(String id);



    //   关注加一
    @Update("UPDATE user SET concern = concern + 1 WHERE id = #{id}")
    public int addconcern(String id);
    @Update("UPDATE user SET concern = concern - 1 WHERE id = #{id}")
    public int delconcern(String id);


//    xml
//    多条件查询
    public List<User> getuserList(String username, Integer type, String sex, String condition, String sort,
                                  @Param("pageNum")int pageName, @Param("pageSize")int pageSize);
    public List<User> getuserListTotal(String username, Integer type, String sex, String condition, String sort);
}
